import http from "@/api";
import { ResPage, OrgManager } from "@/api/interface/index";
import qs from "qs";

/**
 * @name 查询流程实例
 */
// 查询流程实例
export const findPageHistoryProcessInstance = (params: {}, header: string, unhandle: string[]) => {
  let newobj = {};
  if (header != null && header != "") {
    Object.keys(params).forEach(key => {
      if (unhandle.length > 0) {
        if (unhandle.includes(`${key}`)) {
          newobj[`${key}`] = `${params[key]}`;
        } else {
          newobj[header + "." + `${key}`] = `${params[key]}`;
        }
      } else {
        newobj[header + "." + `${key}`] = `${params[key]}`;
      }
    });
  } else {
    newobj = params;
  }
  return http.postitsm<string>(`/pages/jbpm!findPageHistoryProcessInstance.action`, qs.stringify(newobj));
};

// 跟踪流程图
export const getActivityCoordinates = (params: string) => {
  return http.postitsm<string>(`/pages/jbpm!getActivityCoordinates.action?pid=` + params, qs.stringify({}));
};
